<template>
  <div class="myOrder">
    <q-tabs :refs="$refs" default-tab="tab-2">
      <!--<q-tab name="tab-1" > 旅游订单 </q-tab>-->
      <q-tab name="tab-2"> 活动订单 </q-tab>
      <q-tab name="tab-3"> 好物订单 </q-tab>
    </q-tabs>
    <!-- Targets -->
    <!-- <div ref="tab-1">
       <v-jounery></v-jounery>
     </div>-->
    <div ref="tab-2">
      <v-activity></v-activity>
    </div>
    <div ref="tab-3">
      <v-goods></v-goods>
    </div>
  </div>
</template>
<script>
  import {ctoast, confirmDialog} from '../../common/js/common'
  import {HttpRequest} from '../../common/js/httpFun'
  import {linklist} from '../../common/js/mockdata'
  import Jounery from './jounery'
  import Activity from './activity'
  import Goods from './goods'
  export default({
    data () {
      return {
        user: {
          'tel': '',
          'code': ''
        },
        'timeOut': '获取验证码',
        selectedItem: {}
      }
    },
    created () {
      /* Vue.http.get(linklist.index1).then((response) => {
       // 响应成功回调
       console.log('success', response)
       // resolve(response)
       }, (response) => {
       // 响应错误回调
       console.log('fail', response)
       // reject(response)
       }) */
    },
    methods: {
      createToast (text) {
        ctoast(text)
      },
      createConfirmDialog (msg, yesFun, noFun) {
        confirmDialog(msg, yesFun, noFun)
      },
      login: function (index, done) {
        let result = HttpRequest(linklist.index1)
        result.then((response) => {
          if (response.status === 200) {

          }
        }, (response) => {

        }).catch((response) => {

        })
      },
      sendCode () {
        /* 验证手机号是否正确 */
        if (this.$refs.tel.validity.valueMissing) {
          this.createToast('请填写手机号')
          return false
        }
        else {
          if (!this.$refs.tel.validity.valid) {
            this.createToast('请填写正确的手机号')
            return false
          }
        }
        /* 调用发送验证码接口 */

        let count = 90
        this.timeOut = count + 's'
        this.$refs.vcode.setAttribute('disabled', true)
        let timeInterval = setInterval(() => {
          if (count > 0) {
            count--
            this.timeOut = count + 's'
          }
          else {
            clearInterval(timeInterval)
            this.timeOut = '获取验证码'
            this.$refs.vcode.removeAttribute('disabled')
          }
        }, 1000)
      },
      closeItemFun () {
      }
    },
    components: {
      'v-jounery': Jounery,
      'v-activity': Activity,
      'v-goods': Goods
    }
  })
</script>
<style lang="stylus" rel="stylesheet/stylus" scoped>
  @import "../../common/stylus/redifined.styl"
  p
    setFontsize(18px)
    margin 0
    color #333

  .text-center
    text-align center

  button
    setFontsize(18px)
    width 9.47rem
    height 1.18rem
    color #fff
    min-height auto
    &.primary
      background yellowColor !important
    &.getCode
      color #fff
      background yellowColor
      width cal(180) rem
      height cal(52) rem
      text-align center
      line-height cal(52) rem
      display inline-block
      setFontsize(14px)
      padding 0
      transition all .2s ease-in
      -webkit-transition all .2s ease-in
      &:disabled
        transition all .2s ease-in
        -webkit-transition all .2s ease-in
        color #999
        background #f2f2f2

  .myOrder
    width 100%
    .q-tabs
      height cal(85) rem
      min-height auto
      background #fff
      .q-tab
        min-height auto
        color #333
        &.active
          color yellowColor
          border-bottom 2px solid yellowColor
</style>
